<include file="Public:header"/>
<body class="bgf6">
	<!-- 头部 -->
    <div class="header-container bgfff">
            <div class="weui-cell ih30">
                <div class="weui-cell__hd">

                </div>
                <div class="weui-cell__bd">
                	{$title}
                </div>
            </div>
    </div>
    <!-- 内容 -->
    <div class="xq_container infolist">
        <if condition="!empty($list)">
            <volist name="list" id="v">
    	        <div class="weui-cell pad10 mgb10 bgfff item1">
                    <div class="weui-cell__hd imgbox mgr5 fs0">
                        <img class="h100" src="/{$v.pic}">
                    </div>
                    <a class="weui-cell__bd colblack" href="{:U('Index/article',array('art_id'=>$v['art_id']))}">
                        <div>{$v.title}</div>
                        <div class="line3 fs0-8 h60 br pdr5">{$v.desc}</div>
                    </a>
                    <div class="weui-cell__ft zxbox flex2 flexvcenter">
                        <img class="w30" src="__WEBPUBLIC__/Mobile/img/zx.png">
                        <span>咨询</span>
                    </div>
                </div>
            </volist>
            <else/>
            <div style="text-align:center;padding-top:50px;color: #a0a0a0;">暂无数据</div>
        </if>

    </div>
    <include file="Public:footer"/>
    <div id="dialog1" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__hd"><strong class="weui-dialog__title">咨询详情</strong></div>
            <!-- <div class="weui-dialog__bd">弹窗内容，告知当前状态、信息和解决方法，描述文字尽量控制在三行内</div> -->
            <div class="weui-dialog__ft">
                <a id="lefta" href="tel:{$shop.tel}" class="weui-dialog__btn weui-dialog__btn_default">电话咨询</a>
                <a id="righta" href="{:U('Index/message')}" class="weui-dialog__btn weui-dialog__btn_primary">留言咨询</a>
            </div>
        </div>
    </div>
<script type="text/javascript">

//弹窗
    $('.zxbox').click(function () {
        $('#dialog1').show();
    });
    $('.weui-mask').click(function(){
        $('#dialog1').hide();
    })

$(function(){
    fenye();
})
var myp=1;


function getJson(args) {
        $.get("{:U('Index/ajaxArticle')}",{p:myp},function(data){
            putGoods(data,args);
        },'json');
}

function putGoods(data,args) {
    if(data.flag == 'success'){
        var shops = data.data;
        if((!shops || shops.length == 0 ) && args == "fenye"){
            $(".nomore").remove();
            $(".shoplist").append('<div class="texcen nomore">没有更多了！</div>');
        }
        var str ="";
        for(var index in shops){
            var shop = shops[index];
            str +='<div class="weui-cell pad10 mgb10 bgfff item1">\
                        <div class="weui-cell__hd imgbox mgr5 fs0">\
                            <img class="h100" src="'+shop.pic+'">\
                                </div>\
                        <a class="weui-cell__bd colblack" href="'+shop.url+'">\
                            <div>'+shop.title+'</div>\
                            <div class="line3 fs0-8 h60 br pdr5">'+shop.desc+'</div>\
                            </a>\
                        <div class="weui-cell__ft zxbox flex2 flexvcenter">\
                            <img class="w30" src="__WEBPUBLIC__/Mobile/img/zx.png">\
                                <span>咨询</span>\
                                </div>\
                        </div>' ;
        }
        if (args == "fenye") {
            $('.infolist').append(str);
        }else{
            $('.infolist').html(str);
        }
    }else{

    }
    if (args == "shouci") {
        fenye();
    }
}

function fenye(){
    var flag= true;//防止ajax请求期间，对此触发请求数据
    var $_zd = $(".item1").height();//获取每个单项的高度
    var length = 1;//定义预加载的数量，提前三个加载数据
    var $_par = $(".infolist");//获取包裹容器
    var winheight = $(window).height();//获取窗口高度
    var curpage = 1;//存储当前的页数v
    $(function(){
        $(window).on("scroll",function(e){
            if(flag){
                var self = $(this);
                var scrtop = self.scrollTop() + winheight;
                var docheight = $_par.height();
                if(scrtop > docheight - ( length * $_zd ) ){
                    flag = false;
                    myp = +myp +1;
                    getJson("fenye");
                }
            }
        });
    });
}
</script>
</body>
</html>